<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>员工评价页面</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/static/layui-v2.5.7/layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>

<body>

<ul class="layui-nav">
    <li class="layui-nav-item"><a href="/jump3">主页</a></li>
  <li class="layui-nav-item">
    <a href="javascript:;">员工信息</a>
    <dl class="layui-nav-child">
      <dd><a href="/searchWorkerInfo">查看</a></dd>
    </dl>
  </li>
  <li class="layui-nav-item"><a href="/jump2">员工评价</a></li>
    <li class="layui-nav-item"><a href="/shen_zhaopinfabu">招聘发布</a></li>
     <li class="layui-nav-item"><a href="/shen_zhaopinxinxi">招聘信息</a></li>

    <li class="layui-nav-item layui-col-md-offset7" lay-unselect="">
        <div><img src="/static/img/pimg2.jpg" class="layui-nav-img">{{ u }}</div>
        <dl class="layui-nav-child">
            <dd><a href="/">登出</a></dd>
        </dl>
    </li>
</ul>



<div style="padding: 20px; background-color: #F2F2F2;">
  <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">员工信息表</div>
        <div class="layui-card-body">
           <table class="layui-hide" id="test" lay-filter="test"></table>
        </div>
      </div>
    </div>
    <div class="layui-col-md6">
      <div class="layui-card">
        <div class="layui-card-header">说明</div>
        <div class="layui-card-body">
            1.请从表格中点击按钮选择员工<br>
            2.评价请勾选评价等级<br>
            3.主观评价请写在文本框内<br>
            4.评价完成请点击提交按钮<br><br><br><br>
        </div>
      </div>
    </div>
    <div class="layui-col-md6">
      <div class="layui-card">
        <div class="layui-card-header">评价</div>
        <div class="layui-card-body">
          <div id="test5"></div><br>
            <form class="layui-form" action="">
                <div class="layui-form-item layui-form-text">
                    <textarea placeholder="评价原因" class="layui-textarea" name="eva" id="eva"></textarea>
                </div>
            </form>
        </div>
      </div>
    </div>
  </div>
</div>










<script src="/static/layui-v2.5.7/layui/layui.js" charset="utf-8"></script>
<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">
    <button class="layui-btn layui-btn-sm" lay-event="getCheckData">提交评价</button>
  </div>
</script>


 <script type="text/javascript" src="/static/jquery.min.js"></script>
 <script type="text/javascript">
     var glo=0;
layui.use('table', function(){
  var table = layui.table;

  table.render({
    elem: '#test'
    ,url:'/data'
    ,toolbar: '#toolbarDemo'
    ,cols: [[
      {type:'radio'}
      ,{field:'id', width:175, title: 'ID'}
      ,{field:'name', width:175, title: '名字'}
      ,{field:'sex', width:175, title: '性别'}
      ,{field:'tel', width:175, title: '电话'}
      ,{field:'email', width:175, title: '邮箱'}
      ,{field:'major', width:175, title: '专业'}
      ,{field:'school', width:175, title: '学校'}
      ,{field:'education', width:175, title: '学历'}
    ]]
    ,page: true
  });

  //头工具栏事件
  table.on('toolbar(test)', function(obj){
    var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
    switch(obj.event){
      case 'getCheckData':
        var data = checkStatus.data;  //获取选中行数据
          var data1 = document.getElementById("eva").value;
          var cdata=JSON.stringify(data)+data1+glo.toString();
        $.ajax({
            url:"/query",
            type:"post",
            data:cdata,
            success:function (data){
                layer.alert("success!")
            },
            error:function(){
                alert("error")
            }
        })
      break;
    };
  });
});


layui.use(['rate'], function(){
  var rate = layui.rate;
  //基础效果
  rate.render({
    elem: '#test1'
  })

  //显示文字
  rate.render({
    elem: '#test2'
    ,value: 2 //初始值
    ,text: true //开启文本
  });

  //半星效果
  rate.render({
    elem: '#test3'
    ,value: 2.5 //初始值
    ,half: true //开启半星
  })
  rate.render({
    elem: '#test4'
    ,value: 3.5
    ,half: true
    ,text: true
  })

  //自定义文本
  rate.render({
    elem: '#test5'
    ,value: 3
    ,text: true
    ,setText: function(value){ //自定义文本的回调
      var arrs = {
        '1': '一星'
        ,'2': '二星'
        ,'3': '三星'
        ,'4': '四星'
        ,'5': '五星'
      };
      glo=value;
      this.span.text(arrs[value] || ( value + "星"));
    }
  })
  rate.render({
    elem: '#test6'
    ,value: 1.5
    ,half: true
    ,text: true
    ,setText: function(value){
      this.span.text(value);
    }
  })

  //自定义长度
  rate.render({
    elem: '#test7'
    ,length: 3
  });
  rate.render({
    elem: '#test8'
    ,length: 10
    ,value: 8 //初始值
  });

  //只读
  rate.render({
    elem: '#test9'
    ,value: 4
    ,readonly: true
  });

  //主题色
  rate.render({
    elem: '#test10'
    ,value: 3
    ,theme: '#FF8000' //自定义主题色
  });
  rate.render({
    elem: '#test11'
    ,value: 3
    ,theme: '#009688'
  });

  rate.render({
    elem: '#test12'
    ,value: 2.5
    ,half: true
    ,theme: '#1E9FFF'
  })
  rate.render({
    elem: '#test13'
    ,value: 2.5
    ,half: true
    ,theme: '#2F4056'
  });
  rate.render({
    elem: '#test14'
    ,value: 2.5
    ,half: true
    ,theme: '#FE0000'
  })
});

layui.use('element', function(){
  var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

  //监听导航点击
  element.on('nav(demo)', function(elem){
    //console.log(elem)
    layer.msg(elem.text());
  });
});
</script>





</body>
</html>